import util from '../../utils/util'
import {
  GetVideoCenter
} from '../../config/api'
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isEmpty: false,
    model: '',
    videoLists: [], //视频数据

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

    let that = this;
    let model = wx.getStorageSync('model')
    this.setData({
      model
    })

    util.apiRequest(GetVideoCenter, {
      vollege_id: app.globalData.vollege_id
    }, null).then(r => {
      console.log('视频数据：', r.data.data.data);

      if (r.data.data.data.length == 0) {
        that.setData({
          isEmpty: true
        })
      } else {
        that.setData({
          isEmpty: false
        })
      }

      that.setData({
        videoLists: r.data.data.data
      });
    });

  },

  toDetail(e) {
    console.log(e)
    let id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/pages/shipin/shipinDetail/shipinDetail?id=' + id,
    })
  },

})